package pl.enigmatic.parser.string.java.awt;

import java.awt.Point;

import pl.enigmatic.parser.string.ArrayConverter;
import pl.enigmatic.parser.string.Converter;


public class PointConverter extends Converter<Point> {

	private final ArrayConverter<Integer> array = new ArrayConverter<Integer>(Integer[].class);

	@Override
	public Point convert(String value) {
		Integer[] coords = array.convert(value);
		return new Point(coords[0], coords[1]);
	}

	@Override
	public String convertBack(Point value) {
		return array.convertBack(new Integer[] { value.x, value.y });
	}

}
